package cn.edu.zut.score.core.convert;

import cn.edu.zut.score.core.domain.ImportUser;
import cn.edu.zut.score.core.dto.response.UserResponse;
import cn.edu.zut.score.core.entity.Info;
import cn.edu.zut.score.core.entity.User;
import io.swagger.annotations.ApiModel;
import org.mapstruct.*;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author zby
 * @date 2021/06/27
 */
@ApiModel("用户相关转换器")
@Mapper(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE, nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface UserConvert {

    UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);

    @Mapping(source = "clazzId", target = "clazz")
    UserResponse user2Response(User user);

    List<UserResponse> users2Responses(List<User> users);

    List<Info> users2Infos(List<User> users);

    User importUser2User(ImportUser importUser);
}
